﻿using DXApplicationTangche.DTO;
using DXApplicationTangche.UC.套号管理.套号吊牌.service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.套号管理.套号吊牌.model
{
    public class 套号吊牌Model
    {
        public List<DTO套号吊牌> DTO套号吊牌s { get; set; } = new List<DTO套号吊牌>();
        private List<MeasureItemDTO> measureItemDTOS = new List<MeasureItemDTO>();
        /// <summary>
        /// 打印是给打印页面的成衣值赋值
        /// </summary>
        /// <param name="measureItemDTOS"></param>
        /// <returns></returns>
        public 套号吊牌Model buildDTO套号吊牌s(List<MeasureItemDTO> measureItemDTOS)
        {
            this.measureItemDTOS = measureItemDTOS;
            foreach (MeasureItemDTO dTO in this.measureItemDTOS)
            {
                switch (dTO.itemNameCn)
                {
                    case "胸围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("bust", dTO.garmentSize.ToString()));
                        break;
                    case "肩宽":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("shoulderWidth", dTO.garmentSize.ToString()));
                        break;
                    case "衣长":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("clothesLength", dTO.garmentSize.ToString()));
                        break;
                    case "袖长":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("sleeveLength", dTO.garmentSize.ToString()));
                        break;
                    case "摆围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("swingAround", dTO.garmentSize.ToString()));
                        break;
                    case "袖口":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("cuff", dTO.garmentSize.ToString()));
                        break;
                    case "袖肥":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("sleeveFertilizer", dTO.garmentSize.ToString()));
                        break;
                    case "腰围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("waist", dTO.garmentSize.ToString()));
                        break;
                    case "裙长":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("skirtLength", dTO.garmentSize.ToString()));
                        break;
                    case "臀围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("hipline", dTO.garmentSize.ToString()));
                        break;
                    case "裤长":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("trousersLength", dTO.garmentSize.ToString()));
                        break;
                    case "大腿围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("thighCircumference", dTO.garmentSize.ToString()));
                        break;
                    case "膝围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("kneeCircumference", dTO.garmentSize.ToString()));
                        break;
                    case "裤口围":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("trousersGirth", dTO.garmentSize.ToString()));
                        break;
                    case "裤内长":
                        this.DTO套号吊牌s.Add(new DTO套号吊牌("inseam", dTO.garmentSize.ToString()));
                        break;
                    default:
                        break;
                }
            }
            return this;
        }

        
        private List<DTO条码> list = new List<DTO条码>();
        /// <summary>
        /// 打开打印页面下的条码状态的列表
        /// </summary>
        /// <param name="inventoryNos"></param>
        /// <returns></returns>
        public List<DTO条码> build列表(List<String> inventoryNos)
        {
            foreach (String item in inventoryNos)
            {
                this.list.Add(new DTO条码(item));
            }
            return this.list;
        }

        /// <summary>
        /// 每次扫描条码该表状态
        /// </summary>
        /// <param name="list"></param>
        /// <param name="inventoryNo"></param>
        /// <returns></returns>
        public List<DTO条码> build条码状态(List<DTO条码> list,String inventoryNo)
        {
            foreach (DTO条码 item in list)
            {
                if (inventoryNo.Equals(item.inventoryNo))
                {
                    item.flag = true;
                }
            }
            return list;
        }
    }
    


}
